#include "../include/Condition.hpp"


wd::Condition::Condition(MutexLock & mutex)
:_mutex(mutex)
{
    pthread_cond_init(&_cond,NULL);
}

wd::Condition::~Condition(){
    pthread_cond_destroy(&_cond);

}

void wd::Condition::wait(){
    pthread_cond_wait(&_cond,_mutex.getMutexLockPtr());
}


void wd::Condition::notifyOne(){
    pthread_cond_signal(&_cond);
}


void wd::Condition::notifyAll(){
    pthread_cond_broadcast(&_cond);
}
